$(document).ready(function(){
	queryMenu();
})

function queryMenu(){
	$.ajax({
		type: 'post',
		url: cw.common.path + '/json',
		data: 'action=QUERY_MENU_ACTION',
		cache: true,
		dataType: 'json',
		async: false,
		success:function(data){
			if(data.success){
				var menu = data.root.FUNCTION_ID.rs;
				var str = '';
				$.each(menu,function(i,objX){
					if(objX.FUNCTION_DESC=="menu1"){
						str += '<div class="header" id="'+i+'-header" style="text-align:center">'+objX.FUNCTION_NAME+'</div>';
						str += '<div class="content" id="'+i+'-content" style="text-align:center; padding-left:1px;"><div class="index_menu_nav"><ul>';
						$.each(menu,function(j,objY){
							if(objY.FUNCTION_DESC=="menu2" && objX.FUNCTION_ID == objY.PARENT_FUNCTION){
								str += '<li><a href="'+objY.URL+'" target="mainFrame">'+objY.FUNCTION_NAME+'</a></li>';
							}
						});
						str += '</ul></div></div>';
					}
				});
				$('#menu').append(str);
			}
			else{
				alert(data.errors.errmsg);
			}
		}
	})
}